//
//  RoundProgressView.m
//  test_round_progress
//
//  Created by liuyu on 15/7/6.
//  Copyright (c) 2015年 liuyu. All rights reserved.
//

#import "RoundProgressView.h"

@implementation RoundProgressView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)drawRect:(CGRect)rect
{
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    CGContextSetStrokeColorWithColor(context, [UIColor greenColor].CGColor);
    CGContextSetFillColorWithColor(context, [UIColor redColor].CGColor);
    CGAffineTransform transform = CGAffineTransformMakeTranslation(100, 100);
    CGMutablePathRef path = CGPathCreateMutable();
    CGPathMoveToPoint(path, &transform, 0, 0);
    CGPathAddLineToPoint(path, &transform, 100, 0);
    CGPathAddArcToPoint(path, &transform, 100, 0, -100, 0, 100);
    CGPathAddArc(path, &transform, 0, 0, 100, 0, 3.14, YES);
    CGPathAddLineToPoint(path, &transform, 0, 0);

    CGContextAddPath(context, path);
    CGContextFillPath(context);
}

@end
